package com.lxyk.sgq;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.lxyk.sgq.service.IOrderService;
import com.lxyk.sgq.utils.AjaxResult;

import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class})
@EnableDiscoveryClient
@RestController
public class Day94SupermarketApplication {

    @DubboReference
    private IOrderService orderService;

    public static void main(String[] args) {

        SpringApplication.run(Day94SupermarketApplication.class,args);

    }

    @GetMapping("/shopping/{id}")
    public AjaxResult shopping(@PathVariable("id") Integer id){
        return orderService.addOrder(id);
    }
}
